using UnityEngine;
using System.Collections;

public class badGuyClass : MonoBehaviour {
	
	public GameObject Target;	
	public float MobCurrentSpeed = 0.1f;
	//private Vector3 dir;
	private float xMove;
	private float yMove;
	private float angle;
	public bool gameStopped = false;
	//public const float zCorrection = -1;

	// Use this for initialization
	void Start () {		
		angle = Mathf.Atan2(transform.position.y - Target.transform.position.y,
			transform.position.x - Target.transform.position.x);
		yMove = MobCurrentSpeed*Mathf.Sin(angle);
		xMove = MobCurrentSpeed*Mathf.Cos(angle);
	}
	/*public void setPause(bool pause){
		if (pause){
			gameStopped = true;
		}else{
			gameStopped = false;
		}
	}*/
	public void moveMe(){
		this.gameObject.transform.position = new Vector3(this.gameObject.transform.position.x - xMove,
			this.gameObject.transform.position.y - yMove, -1);
	}
	
	// Update is called once per frame
	void Update () {
		/*Vector3 delta = dir * (MobCurrentSpeed * Time.deltaTime);
		Debug.Log(delta);
		
		Vector3 pos = transform.position + dir * (MobCurrentSpeed * Time.deltaTime);
		pos.z = zCorrection;
		transform.position = pos;*/
		//this.gameObject.transform.position = new Vector3(this.gameObject.transform.position.x - xMove,
		//	this.gameObject.transform.position.y - yMove, -1);
	}
}
